package cn.com.dingtek.genius.manager.server.support;

import lombok.Getter;

import java.util.Arrays;
import java.util.Optional;

@Getter
public enum OsType {
    /**
     *
     */
    ANDRIOD(1, "安卓"),
    IOS(2, "IOS"),
    ELSE(3, "其他");

    private int value;
    private String desc;

    OsType(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    public static Optional<OsType> valueOf(Integer value) {
        return Arrays.stream(OsType.values())
                .filter(item -> item.getValue() == value)
                .findFirst();
    }

    @Override
    public String toString() {
        return desc;
    }
}
